/* Copyright 2011-2016 Tyler Gilbert; 
 * This file is part of Stratify OS.
 *
 * Stratify OS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Stratify OS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Stratify OS.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * 
 */

/*! \addtogroup UNI_PROCESS
 * @{
 */

/*! \file */

#include <errno.h>
#include <sys/types.h>

/*! \details This function is not supported.
 *
 * \return Zero on success or -1 on error with errno (see \ref ERRNO) set to:
 *  - ENOTSUP:  function is not supported
 *
 */
pid_t fork();

pid_t _fork(){
	//This function can not be supported unless the CPU has an MMU
	errno = ENOTSUP;
	return -1;
}

/*! \details This function is not supported.
 *
 * \return Zero on success or -1 on error with errno (see \ref ERRNO) set to:
 *  - ENOTSUP:  function is not supported
 *
 */
pid_t vfork();

pid_t _vfork(){

	//create a new process copying the characteristic of the current process (has new process ID -- all else identical)

	//manipulate the stack of the current task so that the child process ID is immediately returned


	//Force a switch to the child process -- block the parent process execution


	//return 0 (as the child)


	//when exec() or _exit() is run -- the parent process needs to be woken up


	//Use the following label as the PC for the parent
	//parent_process_resume:

	errno = ENOTSUP;
	return -1;
}

/*! @} */

